package com.sunxueqi.project.system.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sunxueqi.common.constant.CfnConstants;
import com.sunxueqi.framework.security.service.LoginService;
import com.sunxueqi.framework.web.vo.ResponseData;

@RestController
public class LoginController {
	
	@Autowired
	private LoginService loginService;
	
	/**
	 * 接收登录接口的参数
	 * @param username 用户名
	 * @param password 密码
	 * @param code 验证码
	 * @param uuid 唯一标识
	 * @return 响应结果
	 */
	@PostMapping("/login")
	public ResponseData login(String username, String password, String code, String uuid) {
		ResponseData respData = ResponseData.success();
		String token = loginService.login(username, password, code, uuid);
		respData.put(CfnConstants.TOKEN, token);
		return respData;
	}
	
	@GetMapping("/test")
	public String test() {
		return "okok.";
	}
}
